package com.qq.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.qq.bean.Users;
import com.qq.service.UsersService;
import com.qq.service.impl.FriendshipServiceImpl;
import com.qq.service.impl.UsersServiceImpl;

@WebServlet("/deletaddFriend.do")
public class UpdateStateByDelBtnServlet extends HttpServlet{
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		FriendshipServiceImpl fs = new FriendshipServiceImpl();
		UsersService us = new UsersServiceImpl();
		String me = req.getParameter("myAccount");
		String friendAccount = req.getParameter("friendAccount");
		int row = fs.updateStateBy(me, friendAccount);
		System.out.println(row+"删除");
		//System.out.println(u);
		ObjectMapper mapper = new ObjectMapper();
		String json = mapper.writeValueAsString(row);
		resp.setContentType("application/json;charset=utf-8");
		mapper.writeValue(resp.getWriter(), json);
		
	}
}